import java.util.ArrayList;
import java.util.Collections;


public class Ex2_6 {


	private ArrayList<Integer> spectrum;

	public Ex2_6() {	
		spectrum = new ArrayList<Integer>();
		loadSpectre("C:\\Users\\josemfer\\Downloads\\dataset_26_4.txt");

	}

	private void convolute() {
		ArrayList<Integer> c = new ArrayList<Integer>();
		Collections.sort(spectrum);
		Collections.reverse(spectrum);
		for (int i=0;i<spectrum.size()-1;i++) {
			
			/*if (i==12) {
				System.out.println("STOP");
			} */
			
			for (int j=i+1;j<spectrum.size();j++) {				
				Integer r = spectrum.get(i) - spectrum.get(j);
				c.add(r);			
							
			}
		}
		
		Collections.sort(c);
		
		System.out.println(formatter(c));




	}


	private String formatter(ArrayList<Integer> peptide) {	

		return peptide.toString().replaceAll("\\]", "").
				replaceAll("\\[", "");
	}

	private void loadSpectre(String file) {		
		try {
			String inputFile = KmerCounter.readFile(file);
			for (String s : inputFile.split("\\s+")) {
				spectrum.add(new Integer(s));
			}

		} catch (Exception e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}		
	}

	
	public static void main(String[] args) {
		
		Ex2_6 e = new Ex2_6();
		e.convolute();
		
		
	}


}
